<?php

namespace App\Http\Requests\Wechat;

use App\Http\Requests\Common\Request;
use EasyWeChat\Kernel\Messages\Text;

class WechatRequest extends Request
{
    //
    public function service()
    {
        $app    = app('wechat');
        $server = $app->server;
        $server->setMessageHandler(function ($message) {
        	//
            $openId = $message->FromUserName;
            $txt = new Text("{$message->MsgType}:{$message->Event}:{$message->Content}");
            return $txt;
        });
        return $server->serve();
    }
}
